package com.ningxia.water.service;

import com.ningxia.water.entity.JobTask;
import com.baomidou.mybatisplus.extension.service.IService;
import org.quartz.SchedulerException;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author hz
 * @since 2021-05-19
 */
public interface IJobTaskService extends IService<JobTask> {


    /**
     * 初始化任务，从数据库中读取
     * @throws SchedulerException
     */
    void initSchedule() throws SchedulerException;

    /**
     * 改变任务状态
     * @param id
     * @param jobStatus
     * @return
     */
    boolean changeJobStatus(Integer id, String jobStatus) throws SchedulerException;


    /**
     * 执行任务
     * @param jobtask
     */
    void run(JobTask jobtask) throws SchedulerException;

    /**
     * 通过jobId修改cron表达式
     * @param jobId
     * @return
     */
    boolean updateCronExpression(Integer jobId,String cronExpression) throws SchedulerException;

    /**
     * 删除任务
     * @param id
     * @return
     */
    boolean removeJobTask(Integer id);
}
